import { createStore, applyMiddleware } from 'redux';
// import sagaMiddlewareFactory from 'redux-saga';
import sagaMiddlewareFactory from '@/redux-saga';
import reducers from './reducers';
import rootSaga from './saga';
const sagaiddleware = sagaMiddlewareFactory();
// 1 应用中间件
const store = applyMiddleware(sagaiddleware)(createStore)(reducers);
// 2 run saga
sagaiddleware.run(rootSaga);

window.dispatch = store.dispatch;

export default store;